package com.xinhua.erp.repo;

import com.xinhua.erp.pojo.Purchase;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface PurchaseRepo extends JpaRepository<Purchase, Long>, JpaSpecificationExecutor<Purchase> {
    Page<Purchase> findAllByType(String type, Pageable pageable);

    @Modifying
    @Query(value = "update purchase set status='已审核' where id =?",nativeQuery = true)
    void updatestatus(Long id);
}
